package cn.nexd.framework.util;

import android.util.Log;

/**
 * Created by wangxu on 16/7/26.
 */
public class Logger {


    private static final String TAG = "Logger";

    public static volatile boolean DEBUG = false;

    public static void debug(String TAG, String message) {
        debug(TAG, message, null);
    }

    public static void debug(String TAG, String message, Throwable throwable) {
        if (!DEBUG) {
            return;
        }
        Log.d(Logger.TAG, "************************* " + TAG + " *************************");
        Log.d(Logger.TAG, message, throwable);
        Log.d(Logger.TAG, "************************* " + TAG + " *************************");
    }

    public static void info(String TAG, String message) {
        info(TAG, message, null);
    }


    public static void info(String TAG, String message, Throwable throwable) {
        if (!DEBUG) {
            return;
        }
        Log.i(Logger.TAG, "************************* " + TAG + " *************************");
        Log.i(Logger.TAG, message, throwable);
        Log.i(Logger.TAG, "************************* " + TAG + " *************************");
    }

    public static void error(String TAG, String message) {
        error(TAG, message, null);
    }

    public static void error(String TAG, String message, Throwable throwable) {
        Log.e(Logger.TAG, "************************* " + TAG + " *************************");
        Log.e(Logger.TAG, message, throwable);
        Log.e(Logger.TAG, "************************* " + TAG + " *************************");
    }

    public static void warning(String TAG, String message) {
        warning(TAG, message, null);
    }

    private static void warning(String TAG, String message, Throwable throwable) {
        Log.w(Logger.TAG, "************************* " + TAG + " *************************");
        Log.w(Logger.TAG, message, throwable);
        Log.w(Logger.TAG, "************************* " + TAG + " *************************");
    }
}
